<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>条件渲染</title>
    <script src="./js/vue.js"></script>
</head>
<body>
    <div id="root">
        <h2>当前n值是: {{n}}</h2>
        <button @click="n++">点我n+1</button>

        <!-- v-show进行条件渲染 -->
        <div v-show="false">啊啊啊啊啊</div>
        <div v-show="n === 1">当前n=1</div>

        <!-- 使用v-if进行条件渲染 -->
        <div v-if="n === 1">当前——n=1</div>
        <div v-if="n === 2">当前——n=2</div>
        <div v-if="n === 3">当前——n=3</div>

        <div v-if="n === 1">当前——n=1</div>
        <div v-else-if="n === 2">当前——n=2</div>
        <div v-else>当前——n=另外的值</div>

        <!-- template 与 v-if 结合 -->
        <template v-if="n === 5">
            <h2>你好</h2>
            <h2>Vueeeee</h2>
            <h2>上海</h2>
        </template>
    </div>
</body>
<script>
    new Vue({
        el: "#root",
        data: {
            n: 0
        }
    })
</script>
</html>